﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class _Login : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 系统注册

        if (Request["SystemRegInfo"] == "SystemReg")
        {
            if (PublicFunction.SystemRegister())
            {
                Shove._Web.JavaScript.Alert(this.Page, "系统注册成功！", "Default.aspx");

                return;
            }
        }

        if (Request["SystemRegInfo"] == "SystemNoReg")
        {
            if (PublicFunction.SystemNoRegister())
            {
                Shove._Web.JavaScript.Alert(this.Page, "取消注册成功！", "Default.aspx");

                return;
            }
        }

        #endregion

        #region 验证码

        int IsUseCheckCode = PublicFunction.GetOptionsAsInt(("Opt_CheckCodeCharset"), 0); //0 不使用验证码  1 字母 2小写字母 3 大写字母 4 数字 5 所有字符

        if (IsUseCheckCode == 0)
        {
            lbCheckCoode.Visible = false;
            CheckCode.Visible = false;
        }
        else
        {
            new Login().SetCheckCode(_Site, ShoveCheckCode1);
        }

        #endregion
       
    }

    protected override void OnLoad(EventArgs e)
    {
        isRequestLogin = false;

        base.OnLoad(e);
    }

    protected void btnLogin_Click(object sender, System.EventArgs e)
    {
        string ReturnDescription = "";

        int Result = new Login().LoginSubmit(this.Page, _Site, tbName.Text, tbPassword.Text, tbCheckCode.Text, ref ReturnDescription);

        if (Result < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, ReturnDescription);

            return;
        }

        new Login().GoToRequestLoginPage("_Default.aspx");
    }

}